package sf.jooq;

import org.jooq.SQLDialect;
import sf.spring.util.StringUtils;

public class JooqDialectUtils {
    public static SQLDialect getSQLDialect(String type) {
        if (StringUtils.hasLength(type)) {
            switch (type) {
                case JooqSupportDatabase.H2:
                    return SQLDialect.H2;
                case JooqSupportDatabase.DERBY:
                    return SQLDialect.DERBY;
                case JooqSupportDatabase.MYSQL:
                    return SQLDialect.MYSQL;
                case JooqSupportDatabase.HSQLDB:
                    return SQLDialect.HSQLDB;
                case JooqSupportDatabase.SQLITE:
                    return SQLDialect.SQLITE;
                case JooqSupportDatabase.MARIADB:
                    return SQLDialect.MARIADB;
                case JooqSupportDatabase.FIREBIRD:
                    return SQLDialect.FIREBIRD;
                case JooqSupportDatabase.POSTGRES:
                    return SQLDialect.POSTGRES;
                case JooqSupportDatabase.DEFAULT:
                    return SQLDialect.DEFAULT;
                default:
                    break;
            }
        }
        return null;
    }
}
